/**
 * 
 */
package com.zhiteng.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiteng.entity.Assignee;
import com.zhiteng.mapper.AssigneeMapper;
import com.zhiteng.service.AssigneeService;

/**
 * <p>
 * Title: AssigneeServiceImpl.java
 * </p>
 * <p>
 * Description:审批人Service
 * </p>
 * 
 * @author dragon
 * @date 2018年12月5日
 * @version 1.0
 */
@Service
public class AssigneeServiceImpl implements AssigneeService {
	@Autowired
	private AssigneeMapper assigneeMapper;

	@Override
	public int saveAssignee(Assignee assignee) {
		return assigneeMapper.insert(assignee);
	}

	@Override
	public List<Assignee> queryAssigneeBySchoolId(String schoolId) {
		Assignee record = new Assignee();
		record.setSchoolId(schoolId);
		record.setDel_flag(1); //	删除标志：0-删除  1-未删除
		return assigneeMapper.select(record);
	}

	@Override
	public Assignee queryAssigneeId(String assignee_id) {
		return assigneeMapper.selectByPrimaryKey(assignee_id);
	}

	@Override
	public int deleteAssigneeBatch(String[] assigneeIds) {
		int count = 0;
		for (String assigneeId : assigneeIds) {
			Assignee assignee = new Assignee();
			assignee.setId(assigneeId);
			assignee.setDel_flag(0); //	删除标志：0-删除  1-未删除
			int a = assigneeMapper.updateByPrimaryKeySelective(assignee);
			count += a;
		}
		return count;
	}

}
